import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/material.dart';
import 'package:hockey/extensions/jzx_widget_extension.dart';
import 'package:hockey/jzx_apps.dart';

import 'controller.dart';

class JzxIntrSilderView extends GetView<JzxIntrSilderController> {
  const JzxIntrSilderView({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black,
      body: [
        Swiper(
          loop: false,
          itemCount: 3,
          autoplay: true,
          // autoplayDelay: 2000,
          itemBuilder: (context, index) {
            final item = controller.intrList[index];
            return Container(
              padding: EdgeInsets.only(
                top: 520.w + kStatusBarHeight,
                left: 24.w,
                right: 28.w,
              ),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  item.image.image(width: 90.w, height: 6.w),
                  JzxGaps.h20,
                  Text.rich(
                    TextSpan(children: [
                      TextSpan(
                        text: item.title,
                        style: const Color(0xFF63FF6A).font_32.medium,
                      ),
                      TextSpan(
                        text: item.content,
                        style: Colors.white.font_16,
                      ),
                    ]),
                    style: const TextStyle(height: 1.8),
                  ),
                ],
              ),
            );
          },
          onIndexChanged: (value) {
            controller.index = value;
            if (value == 2) {
              controller.jumpTo();
            } else {
              controller.cancel();
            }
          },
        ),
      ].backgroud([
        Assets.images.splashBgv,
        // Assets.images.normalBgv,
      ]),
    );
  }
}
